package pers.mobian.springforth;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;

/**
 * @Date 2021/7/10 19:51
 * @Created mobian
 * @Description
 */

@Service
public class UserService2 implements InitializingBean {

	private User user;

	public UserService2() {
		System.out.println("实例化————无参构造方法");
	}

	@Autowired(required = true)
	public void setUser(User user) {
		System.out.println("set的方法赋值");

		this.user = user;
	}


	@PostConstruct
	public void xxx() {
		System.out.println("初始化————之前的方法@PostConstruct");
	}


	@Override
	public void afterPropertiesSet() throws Exception {
		System.out.println("初始化————方法");
	}

}
